package se3a04.mcmapster;

import java.util.ArrayList;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class chooseHunt extends ListActivity{
	
	static String chosenHunt;
	ArrayList<String> registeredHunts = huntRegistration.registeredList;
	
	@Override
	protected void onCreate(Bundle chooseHuntState) {
		
		super.onCreate(chooseHuntState);
			
		if(huntRegistration.registeredList.isEmpty() == true) {
			
			Intent startHuntRegistration = new Intent("se3a04.mcmapster.HUNTFAIL");
			startActivity(startHuntRegistration);
		}
		
		else {
		
			setListAdapter(new ArrayAdapter<String>(chooseHunt.this, android.R.layout.simple_list_item_1, registeredHunts));
		}
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		
		super.onListItemClick(l, v, position, id);
		chosenHunt = registeredHunts.get(position);
		Intent currentHunt = new Intent("se3a04.mcmapster.CURRENTHUNT");
		startActivity(currentHunt);
	}
}